package com.example.qingyiapp.ui.activity.fragment.fragment_FindUI.childfragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.qingyiapp.R;
import com.example.qingyiapp.ui.activity.fragment.fragment_FindUI.adapter.ChoicenessAdapter;
import com.example.qingyiapp.ui.activity.fragment.fragment_FindUI.utils.ChoicenessBean;
import com.jcodecraeer.xrecyclerview.XRecyclerView;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Creadted by Met·Wang on 2019/9/17 14:11
 * Describe: NullPointerException Write
 */
public class Choiceness extends Fragment {

    @BindView(R.id.choiceness_xrecyler)
    XRecyclerView choicenessXrecyler;
    Unbinder unbinder;

    ArrayList<ChoicenessBean>  list;
    ChoicenessAdapter adapter;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.fragment_find_choiceness, container, false);
        unbinder = ButterKnife.bind(this, inflate);


        list=new ArrayList<>();
        list.add(new ChoicenessBean("话题广场","更多话题","http://www.iqingyi.com/topic/getHotTopicPosts?startidx=3&num=3"));
        list.add(new ChoicenessBean("游记攻略","","http://www.iqingyi.com/recommend/getBestNoteAndRoadmap?startidx=0&num=20"));
        LinearLayoutManager manager=new LinearLayoutManager(getContext());
        choicenessXrecyler.setLayoutManager(manager);
        adapter=new ChoicenessAdapter(list,getContext());
        choicenessXrecyler.setAdapter(adapter);

        return inflate;

    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
